package com.beibei.core.data.dao.impl;

import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;

import org.springframework.jdbc.core.PreparedStatementSetter;

import com.beibei.core.data.bean.DataDictionary;
import com.beibei.core.data.bean.DataDictionarySQL;
import com.beibei.core.data.dao.IDataDictionaryDao;
import com.beibei.framework.dao.impl.BaseDaoImpl;

/**
 * 数据字典服务类
 * 
 * @author 309814490@qq.com
 * @since 2014-02-12
 */
public class DataDictionaryDaoImpl extends BaseDaoImpl implements
		IDataDictionaryDao {

	/**
	 * 保存数据字典大类
	 * 
	 * @param dictionary
	 * @return
	 */
	public boolean saveDataDictionary(final DataDictionary dictionary) {
		String method = "saveDataDictionary";
		try {
			getCommonLogger().info(method, "dictionary", dictionary.toString());

			getJdbcTemplate().update(DataDictionarySQL.saveDataDictionary,
					new PreparedStatementSetter() {

						public void setValues(PreparedStatement ps)
								throws SQLException {
							ps.setString(1, dictionary.getName()); // 输入参数
							ps.setString(2, dictionary.getValue()); // 输入参数
							ps.setString(3, dictionary.getStatus()); // 输入参数
						}

					});

			return true;
		} catch (Exception e) {
			getCommonLogger().error(method, "Error", e);
		}

		return false;
	}

	/**
	 * 修改数据字典大类
	 * 
	 * @param dictionary
	 * @return
	 */
	public boolean updateDataDictionary(DataDictionary dictionary) {
		return false;
	}

	/**
	 * 根据ID查询数据字典大类
	 * 
	 * @param dictionary
	 * @return
	 */
	public DataDictionary getDataDictionaryById(String id) {
		return null;
	}

	/**
	 * 根据条件分页查询数据字典大类
	 * 
	 * @param dictionary
	 * @return
	 */
	public List<DataDictionary> getDataDictionaryForPager(
			DataDictionary dictionary, int currentPage, int pageSize) {
		return null;
	}

	/**
	 * 保存数据字典小类
	 * 
	 * @param dictionary
	 * @return
	 */
	public boolean saveDataDetail(DataDictionary dictionary) {
		return false;
	}

	/**
	 * 修改数据字典小类
	 * 
	 * @param dictionary
	 * @return
	 */
	public boolean updateDataDetail(DataDictionary dictionary) {
		return false;
	}

	/**
	 * 根据ID查询数据字典小类
	 * 
	 * @param dictionary
	 * @return
	 */
	public DataDictionary getDataDetailById(String id) {
		return null;
	}

	/**
	 * 根据条件分页查询数据字典小类
	 * 
	 * @param dictionary
	 * @return
	 */
	public List<DataDictionary> getDataDetailForPager(
			DataDictionary dictionary, int currentPage, int pageSize) {
		return null;
	}

}
